// test_cors_simple.js - 简单测试CORS配置
const http = require('http');

const options = {
    hostname: 'localhost',
    port: 3000,
    path: '/api/users/login',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Origin': 'http://127.0.0.1:5174'
    }
};

const req = http.request(options, (res) => {
    console.log(`状态码: ${res.statusCode}`);
    console.log('响应头:', res.headers);
});

req.on('error', (error) => {
    console.error('请求错误:', error.message);
});

req.write(JSON.stringify({
    email: 'test@example.com',
    password: 'password123'
}));

req.end();